package Operations;

import Book.BookList;

import java.util.Scanner;

public class FindOperation implements Operation{

    @Override
    public void operation(BookList bookList) {

        Scanner scanner = new Scanner(System.in);

        System.out.println("查找图书");

        System.out.println("输入要查询的图书");
        String name = scanner.nextLine();

        for (int i = 0; i < bookList.getUsedSize(); i++) {
            if (name.equals(bookList.getBooks()[i].getName())) {
                System.out.println("找到该书");
                System.out.println(bookList.getBooks()[i].toString());
                return;
            }
        }

        System.out.println("未找到");
    }
}
